/////////////////////////////////////////////////////////////////////////////////  
// Object tracking widget
// used to reflect an object's properties in a fixed DOM table
// returns an object with property values which are references to DOM nodes
// where the props of the tracked object will be displayed.
//
ZIP.Widget.ObjectTracker = function(object) {

    var refl = getObjectStringRep(obj), tracker
    
    // NOTE refl structure:
    // 1st 3 columns are : [ propName, type, depth ]
    // depth is depth of the prop relative to the top level object

    function _constructor(object) {
    
        tracker = _makeView(object);
        return {
            
        }
    }

    tableAtDepth[0] = makeTableHeader();

    function _makeView(obj) {
        var type, keySet = 0, depth, keys, row, value, prop, curTable, curRow,
            tableAtDepth = [];
            
        
        for (; keySet < refl.length; keySet++) {
            keys = refl[keySet][0];
            type =  refl[keySet][1];
            depth = refl[keySet][2];

            curTable = /*refl[keySet][3] = */ tableAtDepth[depth];

            // every entry needs a row, but first, get the property details from the obj
            prop = getKeyVal(keys, object);
            curRow = /*refl[keySet][4] = */ makeTableRow();
            curRow.setName(prop.key);
            curRow.setType(prop.type);

            curTable.addRow(curRow.row);


            if ( type != 1 /* not object*/ ) {
                // set value of the table's Value cell (a textNode)
                // to the prop's value
                curRow.setValue(prop.value);
                
                /*refl[keySet][5] = prop.value;*/

            }
            else { /* type == 1 object*/
                // create a table for this object

                //we'll deal with depth (ie if > maxLevel etc) later
                if ( depth == 0 ) {} else {}

                tableAtDepth[depth+1] = /*refl[keySet][5] = */ makeTableHeader();
                curRow.setValue( tableAtDepth[depth+1].table );
            }
        }

        /*
        console.log('//************************************************');
        for (var keySet = 0; keySet<refl.length; keySet++) {
            keys = refl[keySet][0];
            type =  refl[keySet][1];
            depth = refl[keySet][2];
            tab = refl[keySet][3];
            row = refl[keySet][4];
            value = refl[keySet][5];

            console.log(keys, type, depth, tab, row, value);
        }
        */
        return tableAtDepth[0].table;
    }
    
    function Widget() { return Widget; }
    Widget.init = _constructor;
    return Widget;

}
    
    

    



Zip.log({/*{options}*/}.init('Logging something')

